<template>
    <d2-container>
      <el-table
        :data="tableData"
        border
        style="width: 100%">
        <el-table-column
          prop="id"
          label="序号">
        </el-table-column>
        <el-table-column
          prop="task_shopname"
          label="店铺名">
        </el-table-column>
        <el-table-column
          prop="baby_id"
          label="宝贝ID">
        </el-table-column>
        <el-table-column
          prop="task_order"
          label="任务ID">
        </el-table-column>
        <el-table-column
          prop="goods_img"
          label="商品图片">
          <template slot-scope="scope">
            <img :src="scope.row.goods_img" style="width:100px;height:100px;" alt="">
          </template>
        </el-table-column>
        <el-table-column label="状态">
          <template slot-scope="scope">
           {{['','刷手未处理','刷手已收货','刷手货未到'][scope.row.status]}}
          </template>
        </el-table-column>
        <el-table-column
          prop="brushhands_tbname"
          label="刷手旺旺">
        </el-table-column>
        <el-table-column label="功能">
           <template slot-scope="scope">
              <el-button type="primary" @click="reminder_submints(scope.row)">冻结</el-button>
           </template>
        </el-table-column>
      </el-table>
      <el-pagination @current-change="handlepageChange"
                     :page-size="10" layout="total, prev, pager, next" :total="Count">
      </el-pagination>
    </d2-container>
</template>

<script>
import { reminderlist,reminder_submint } from "@/api/api";
export default {
        name: "index",
        data(){
            return{
              tableData: [],
              page:1,
              Count:""
            }
        },
        methods:{
          handlepageChange(val) {
            this.page = val
            this.reminderlists()
          },
          reminderlists(){
            let params = {
              page:this.page,
              page_size:10
            }
            reminderlist(params).then((res)=>{
              this.tableData = res.Data
              this.Count = res.Count
              console.log(this.tableData);
            })
          },
          reminder_submints(row){
            this
              .$confirm("确认冻结此用户吗？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
              })
              .then(() => {
                let params = {
                  user_id:Number(row.user_id),
                  reminder_id:row.reminder_id
                }
                reminder_submint(params).then((res)=>{
                  if(res.Status == 200){
                    this.$message({
                      type:"success",
                      message:res.Message
                    })
                    this.reminderlists()
                  }else{
                    this.$message({
                      type:"error",
                      message:res.Message
                    })
                  }
                })
              })
          }
        },
        created() {
          this.reminderlists()
        }
    }
</script>

<style>

</style>
